/**
 * 2009-11-22 下午03:33:25 
 * esignature
 * com.smc.action.hospital
 * HospitalADAction
 */
package com.smc.action.hospital;

/**
 * @author chenheng
 * @version 0.0.1
 */
public class HospitalADAction extends AbstractHospitalAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = -623876543168131780L;
	private int items ;
	
	public int getItems() {
		return items;
	}
	public void setItems(int items) {
		this.items = items;
	}
	public String addHospital() {
		hospitalService.save_AD_IG_SA_hospital(hospital);
		return SUCCESS ;
	}
	public String listHospital() {
		String str1 = request.getParameter("pageIndex");
		String str2 = request.getParameter("pageSize");
		int pageIndex = 1 ;
		try {
			pageIndex = Integer.parseInt(str1);
		} catch (Exception ex) {
			pageIndex = 1 ;
		}
		int pageSize = 30 ;
		try {
			pageSize = Integer.parseInt(str2);
		} catch (Exception ex) {
			pageSize = 30 ;
		}
		int pageCount = 0 ;
		items = hospitalService.count_AD_IG_FE_hospital();
		if ( items % pageSize == 0 ) {
			pageCount = items / pageSize ;
		} else {
			pageCount = items / pageSize + 1 ;
		}
		hospitalList = hospitalService.fetch_AD_IG_FE_hospital(pageIndex, pageSize);
		request.setAttribute("pageIndex", pageIndex);
		request.setAttribute("pageSize", pageSize);
		request.setAttribute("pageCount", pageCount);
		return SUCCESS ;
	}
}
